<!--耗材单详情-->
<div class="wrap">
	<div class="header">
		<span id="return">返回上一级</span>
	</div>
	<!--详情内容-->
	<ul class="order_list">
		<li>
			<label>订单编号</label>
			<span id="orderId"></span>
		</li>
		<li>
			<label>耗材单状态</label>
			<span id="status"></span>
		</li>
		<li>
			<label>纸张种类</label>
			<span id="paperType"></span>
		</li>
		<li>
			<label>纸张规格</label>
			<span id="paperSize"></span>
		</li>
		<li>
			<label>纸张数量</label>
			<span id="paperNum"></span>
		</li>
		<li>
			<label>油墨种类</label>
			<span id="inkType"></span>
		</li>
		<li>
			<label>油墨数量</label>
			<span id="inkNum"></span>
		</li>
		<li>
			<label>材料品类</label>
			<span id="materialType"></span>
		</li>
		<li>
			<label>材料数量</label>
			<span id="materialNum"></span>
		</li>
		<li>
			<label>板材品类</label>
			<span id="boardType"></span>
		</li>
		<li>
			<label>板材数量</label>
			<span id="boardNum"></span>
		</li>
	</ul>
</div>
<script>
	//返回上一级
	$("#return").on("click",function(){
		$("#main").empty();
		$.ajax({
			type:"get",
			url:"cost_order.html",
			success:function(res){
				$("#main").append(res);
			}
		});
	})
	//用cookie获取id
	var id = $.cookie("id");
	$("#orderNum").text(id);
	//订单详情
	$.ajax({
		type:"post",
		url:"http://39.108.164.20/device/SysUser/SuppliesList",
		dataType:"json",
		success:function(res){
			var data = res.result.data;
			for(let i=0;i<data.length;i++){
				if(id==data[i].order_id){
					var paperSize,material;
					if(data[i].paper_size.indexOf("*")!=-1){
						paperSize = "令";
					}else{
						paperSize = "吨";
					}
					if(data[i].material_type.indexOf("骑马钉")!=-1){
						material =  "盒";
					}else if(data[i].material_type.indexOf("胶装")!=-1){
						material =  "克";
					}else{
						material =  "平方米";
					}
					$("#orderId").text(data[i].order_id);
					$("#status").text(data[i].status);
					$("#paperType").text(data[i].paper_type);
					$("#paperSize").text(data[i].paper_size);
					$("#paperNum").text(data[i].paper_num + paperSize);
					$("#inkType").text(data[i].ink_type);
					$("#inkNum").text(data[i].ink_num+"罐");
					$("#materialType").text(data[i].material_type);
					$("#materialNum").text(data[i].material_num+material);
					$("#boardType").text(data[i].board_type);
					$("#boardNum").text(data[i].board_num+"张");
				}
			}
		}
	});
</script>

